const express = require('express')
const router = express.Router()
const artCate_handler = require('../router_handler/artcate')
// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')
// 验证规则对象
const { add_cate_schema, delete_cate_schema, get_cate_schema,update_cate_schema } = require('../schema/artcate')


// 获取文章分类的列表数据
router.get('/cates', artCate_handler.getArticleCates)
// 添加分类
router.post('/addcates', expressJoi(add_cate_schema), artCate_handler.addArticleCates)
// 根据id删除文章分类
router.get('/deletecate/:id', expressJoi(delete_cate_schema), artCate_handler.deleteCateById)
// 根据id获取文章分类
router.get('/cates/:id', expressJoi(get_cate_schema), artCate_handler.getArtCateById)
// 根据id更新分类的信息
router.post('/updatecate',expressJoi(update_cate_schema) , artCate_handler.updateCateById)

module.exports = router